import request from "@/utils/request";

const baseApi = '/homeIndex';

const groupBuyApi = '/group/buy';
/**
 * 分页获取公告列表
 */
export function noticePagingApi(params:object) {
  return request.get(baseApi+'/notice/paging', { params });
}

/**
 * 根据公告id获取公告详情
 */
export function getNoticeDetailApi(id:number) {
  return request.get(`${baseApi}/notice/${id}`);
}

/**
 * 题库中心，统计总题数和参数人数
 */
export function getQuestionCountApi() {
  return request.get(`${baseApi}/stats`);
}

/**
 * 题库中心，获取题库分类
 */
export function getQuestionCountByTypeApi() {
  return request.get(`${baseApi}/categories`);
}

/**
 * 根据题库分类id分页获取题库列表
 */
export function getQuestionListByCategoryIdApi(params:object) {
  return request.get(`${baseApi}/list`, { params });
}

/**
 * 考试中心 获取统计信息
 */
export function getExamCountApi() {
  return request.get(`${baseApi}/exam/stats`);
}

/**
 *  考试中心 获取正在进行的考试
 */
export function getOnGoingExamApi() {
  return request.get(`${baseApi}/exam/ongoing`);
}

/**
 * 分页获取考试列表
 */
export function getExamListPageApi(data:object) {
  return request.post(`${baseApi}/exam/list`, data );
}

/**
 * 获取考试日历
 */
export function getExamCalendarApi() {
  return request.get(`${baseApi}/exam/calendar`);
}

/**
 * 获取首页综合数据
 */
export function getHomeDataApi() {
  return request.get(`${baseApi}/home-data`);
}

/**
 * 获取首页课程分类树形结构数据
 */
export function getCourseCategoryTreeApi() {
  return request.get(`${baseApi}/category/tree`);
}

/**
 * 首页获取今日团购数据
 */
export function getGroupBuyCoursesApi() {
  return request.get(`${baseApi}/group/buy/list`);
}

/**
 * 首页点击立即参团
 */
export function joinGroupBuyApi(id:number) {
  return request.post(`${groupBuyApi}/join/${id}`);
}

/**
 * 首页获取新上好课
 */
export function getNewCoursesApi() {
  return request.get(`${baseApi}/course/new`);
}